Skip to content

Comments

[3.13] gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS#145015

Open
Fidget-Spinner wants to merge 4 commits intopython:3.13from
Fidget-Spinner:3.13_recursion_inconsistency_fix
Open

[3.13] gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS#145015
Fidget-Spinner wants to merge 4 commits intopython:3.13from
Fidget-Spinner:3.13_recursion_inconsistency_fix

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Feb 19, 2026

The problem is that 3.13 actually doesn't guarantee stack consistency always between uops. This manifests as a bug that seems like stack corruption. In 3.14 and 3.15, this isn't a problem because we guarantee stack consistency between uops always by flushing or otherwise. The bandaid for 3.13 is to move all deopts to before we modify the stack.

@marc-hb could you please try the patch and check if it fixes your code? I tried on my end and it does, just need a second checker.

Can't test this easily, as it depends on specific recursion limits and interaction of specialization.

@Fidget-Spinner Fidget-Spinner changed the title gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS [3.13] gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS Feb 19, 2026
@marc-hb
Copy link

marc-hb commented Feb 19, 2026

I cherry-picked the single commit 58c2e83 from this PR on top of v3.13.12 and I can confirm that this solves my issue #145008 and makes that infinite recursion test pass.

(Not like this should matter much but I also ran the other, non-recursive tests in the suite while at it and nothing went wrong)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants